﻿using System;
using System.ComponentModel;

namespace StartupSolution.ViewModel
{
    public class Stock : BaseViewModel
    {
        private int productID;
        private string productName;
        private int categoryID;
        private string quantityPerUnit;
        private decimal unitPrice;
        private int unitsInStock;
        private int unitsOnOrder;
        private int reorderLevel;
        private bool discontinued;

        public int ProductID
        {
            get
            {
                return this.productID;
            }
            set
            {
                if (this.productID != value)
                {
                    this.productID = value;
                    OnPropertyChanged("ProductID");
                }
            }
        }

        public string ProductName
        {
            get
            {
                return this.productName;
            }
            set
            {
                if (this.productName != value)
                {
                    this.productName = value;
                    OnPropertyChanged("ProductName");
                }
            }
        }

        public int CategoryID
        {
            get
            {
                return this.categoryID;
            }
            set
            {
                if (this.categoryID != value)
                {
                    this.categoryID = value;
                    OnPropertyChanged("CategoryID");
                }
            }
        }

        public string QuantityPerUnit
        {
            get
            {
                return this.quantityPerUnit;
            }
            set
            {
                if (this.quantityPerUnit != value)
                {
                    this.quantityPerUnit = value;
                    OnPropertyChanged("QuantityPerUnit");
                }
            }
        }

        public decimal UnitPrice
        {
            get
            {
                return this.unitPrice;
            }
            set
            {
                if (value < 0)
                    throw new Exception("Negative numbers are not allowed.");

                this.unitPrice = value;
                OnPropertyChanged("UnitPrice");
            }
        }

        public int UnitsInStock
        {
            get
            {
                return this.unitsInStock;
            }
            set
            {
                if (value < 0)
                    throw new Exception("Negative numbers are not allowed.");

                this.unitsInStock = value;
                OnPropertyChanged("UnitsInStock");
            }
        }

        public int UnitsOnOrder
        {
            get
            {
                return this.unitsOnOrder;
            }
            set
            {
                if (this.unitsOnOrder != value)
                {
                    this.unitsOnOrder = value;
                    OnPropertyChanged("UnitsOnOrder");
                }
            }
        }

        public int ReorderLevel
        {
            get
            {
                return this.reorderLevel;
            }
            set
            {
                if (this.reorderLevel != value)
                {
                    this.reorderLevel = value;
                    OnPropertyChanged("ReorderLevel");
                }
            }
        }

        public bool Discontinued
        {
            get
            {
                return this.discontinued;
            }
            set
            {
                if (this.discontinued != value)
                {
                    this.discontinued = value;
                    OnPropertyChanged("Discontinued");
                }
            }
        }
    }
}
